package cn.threewaters.qtyy.web.controller.business;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.baomidou.mybatisplus.plugins.Page;

import cn.threewaters.qtyy.common.bean.ResponseJson;
import cn.threewaters.qtyy.dic.one.queryparam.QueryZmkz;
import cn.threewaters.qtyy.dic.one.queryresult.ResultZmkz;
import cn.threewaters.qtyy.service.business.ZmkzService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;

@Api(tags = "照明")
@Controller
@RequestMapping(value = "/zhaoming")
public class ZmkzController {

	@Autowired
	private ZmkzService zmService;

	@ApiIgnore
	@ApiOperation(value = "照明展示页面")
	@RequestMapping(value = "/main", method = RequestMethod.GET)
	public ModelAndView main(ModelMap modelMap) {
		return new ModelAndView("business/zhaoming/zhaoming", modelMap);
	}

	@ApiOperation(value = "概览")
	@RequestMapping(value = "/GLlist", method = RequestMethod.GET)
	@ResponseBody
	public ResponseJson getGLList(QueryZmkz queryZmkz) throws Exception {
		Page<ResultZmkz> pageResult = new Page<ResultZmkz>();
		List<ResultZmkz> zmGLs = zmService.queryZmGL(queryZmkz);
		pageResult.setRecords(zmGLs);
		pageResult.setTotal(zmGLs.size());
		return ResponseJson.builder().success(true).obj(pageResult).build();
	}
}
